package com.zoweunion.mechanic.controller.base;

import com.github.pagehelper.PageInfo;
import com.zoweunion.mechanic.controller.BaseController;
import com.zoweunion.mechanic.model.ResponseBean;
import com.zoweunion.mechanic.service.base.DailyDataService;
import com.zoweunion.mechanic.util.MyException;
import com.zoweunion.mechanic.util.Orgin;
import com.zoweunion.mechanic.util.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/dailyData")
@SuppressWarnings("unchecked")
public class DailyDataController extends BaseController {

    @Autowired
    private DailyDataService dailyDataService;

    /**
     * 日报数据（ktbl）
     * type:month日报数据，year月报数据
     * date:月、日格式都为yyyy-mm-dd，
     */
    @PostMapping("/dailyData")
    public ResponseBean dailyData(@RequestBody Map<String, Object> reqMap) throws MyException {
        logBefore(logger, "日报数据（ktbl）");
        PageInfo pageInfo = dailyDataService.dailyData(reqMap);
        return new ResponseBean(Constants.CODE_SUCCESS, "操作成功", pageInfo);
    }

}
